CMAKE_MINIMUM_REQUIRED(VERSION 3.17)

IF (NOT TARGET OPENH264::H)
    ADD_LIBRARY(OPENH264::H INTERFACE IMPORTED)
    TARGET_INCLUDE_DIRECTORIES(OPENH264::H INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/windows/include")
ENDIF ()

IF (NOT TARGET OPENH264::LIB)
    FIND_LIBRARY(OPENH264_LIB NAMES openh264 PATHS ${CMAKE_CURRENT_SOURCE_DIR}/windows/lib NO_DEFAULT_PATH)
    ADD_LIBRARY(OPENH264::LIB STATIC IMPORTED)
    SET_TARGET_PROPERTIES(OPENH264::LIB PROPERTIES IMPORTED_LOCATION "${OPENH264_LIB}")
ENDIF ()

IF (NOT TARGET LIBRARIES::OPENH264)
    ADD_LIBRARY(LIBRARIES::OPENH264 INTERFACE IMPORTED GLOBAL)
    TARGET_LINK_LIBRARIES(LIBRARIES::OPENH264 INTERFACE
            OPENH264::H
            OPENH264::LIB)
ENDIF ()